package custom;

import android.content.Context;
import android.media.Image;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;

import com.qianfeng.lingshijia.R;

import utils.DownloadUtils;

/**
 * Created by yerj on 2016/1/11.
 */
public class ImportView extends LinearLayout {
    private ImageView import_item_image,import_item_cimage;
    private TextView import_item_title,import_item_cname,import_item_referral,import_item_price;
    public ImageView shoppingCart_iv_import;
    public ImportView(Context context) {
        super(context);
        init();
    }

    public ImportView(Context context, AttributeSet attrs) {
        super(context, attrs);
        init();
    }

    public void init(){
        LayoutInflater.from(getContext()).inflate(R.layout.import_item_layout,this);
        import_item_image = (ImageView) findViewById(R.id.import_item_image);
        import_item_cimage = (ImageView) findViewById(R.id.import_item_cimage);
        import_item_title = (TextView) findViewById(R.id.import_item_title);
        import_item_cname = (TextView) findViewById(R.id.import_item_cname);
        import_item_referral = (TextView) findViewById(R.id.import_item_referral);
        import_item_price = (TextView) findViewById(R.id.import_item_price);

        shoppingCart_iv_import = (ImageView) findViewById(R.id.shoppingCart_iv_import);

    }

    public void setData(String picUrl,String cUrl,String title,String name,String referral,String price){
        import_item_title.setText(title);
        import_item_cname.setText(name);
        import_item_referral.setText(referral);
        import_item_price.setText("¥"+price);
        DownloadUtils.LoadPicture(picUrl, import_item_image);
        DownloadUtils.LoadPicture(cUrl, import_item_cimage);
    }

}
